package com.etime.shycourse.controller.coupons;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.etime.shycourse.config.PageMessage;
import com.etime.shycourse.dto.ActivelogDto;
import com.etime.shycourse.services.coupons.interfaces.ActivelogServices;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName : ActivelogController  //类名
 * @Description :   //描述
 * @Author : W //作者
 * @Date: 2022/3/31  8:52
 */
@Api(tags = "后台-活动管理-活动参与记录日志")
@RestController
@RequestMapping("/sys/ActiveLog")
public class ActivelogController {
    @Autowired
    private ActivelogServices service;

    @ApiOperation("活动参与记录 分页")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageNum", value = "第几页"),
            @ApiImplicitParam(name = "pageSize", value = "每页多少行"),
            // 复用
            /**
             * <p></p>
             * 可根据的查询的条件有：
             * 活动模糊搜索 coupontitle
             * 活动状态 couponlogtype
             * 领取时间 couponlogtime
             * */
            @ApiImplicitParam(name = "coupontitle", value = "可根据活动名模糊搜索"),
            @ApiImplicitParam(name = "couponlogtype", value = "可根据活动状态"),
            @ApiImplicitParam(name = "couponlogtime", value = "可根据活动领取时间"),
    })
    @GetMapping("/page")
    public PageMessage<ActivelogDto> selectActiveLogPage(ActivelogDto dto, Long pageNum, Long pageSize) {
        PageMessage<ActivelogDto> msg = new PageMessage<>();
        Page<ActivelogDto> data = service.selectActiveLogPage(dto, pageNum, pageSize);
        if (data != null) {
            msg.setCode(1);
            msg.setPagedata(data);
        } else {
            msg.setCode(0);
            msg.setMsg("没有查询到数据");
        }
        return msg;
    }
}

